package com.act;

import android.app.Notification;
import android.app.NotificationManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.util.Log;


/**
 * 推送的广播事件
 * 
 * @author Administrator
 *
 */
public class NotificationReceiver extends BroadcastReceiver {

	private static final String TAG = LogUtil.getClassName(NotificationReceiver.class);
	
	@Override
	public void onReceive(Context context, Intent intent) {

		Log.d(TAG, "NotificationReceiver .. onReceive..  is running..");
		
		String action = intent.getAction();
		
//		SharedPreferences sharePre = context.getSharedPreferences(Constants.SET_NOTIFICATION_NAME, Context.MODE_PRIVATE);
		
		int icon = intent.getIntExtra(Constants.NOTIFICATION_ICON, 0);
		String apiKey = intent.getStringExtra(Constants.NOTIFICATION_APIKEY);
		String title = intent.getStringExtra(Constants.NOTIFICATION_TITLE);
		String message = intent.getStringExtra(Constants.NOTIFICATION_MESSAGE);
		String url = intent.getStringExtra(Constants.NOTIFICATION_URL);
		
		if(action.equals(Constants.ACTION_NOTIFICATION_SHOW))
		{
			Notifier notifier = new Notifier(context);
			notifier.notify(icon,apiKey,title,message,url);
		}
	}

}
